#include "mainwindow.h"
#include "ui_mainwindow.h"
#include "help.h"
using namespace std;
MainWindow::MainWindow(QWidget *parent): QMainWindow(parent), ui(new Ui::MainWindow)
{
    ui->setupUi(this);
    this->setWindowTitle("数据库控制台");
    QFont ft ( "Microsoft YaHei", 20, 75);
    ui->label->setFont(ft);
    ft.setPointSize(10);
    ui->label_2->setFont(ft);
    help::setBackground(this,QColor(41,147,204));
    help::setLabelBackground(ui->label,QColor(41,147,204),Qt::black);
    help::setLabelBackground(ui->label_2,Qt::white,Qt::black);
    ui->label_2->installEventFilter(this);
    this->_form=new Form ();
    connect(_form,SIGNAL(showMain()),this,SLOT(showMainshow()));
}

bool MainWindow::eventFilter(QObject *obj, QEvent *ev)
{
    if(obj==ui->label_2)
    {
        if(ev->type()==QEvent::MouseButtonPress)
        {
            this->hide();
            _form->show();
            return true;
        }
    }
    return false;
}

void MainWindow::showMainshow()
{
    this->show();
}

MainWindow::~MainWindow()
{
    delete ui;
}

